草庐IT

JavaScript typeof, null, 和 undefined

全部标签

javascript - Jquery 未捕获类型错误 : Cannot read property 'replace' of undefined

任何人都可以告诉我为什么会出现此错误:未捕获的类型错误:无法读取未定义的属性“替换”functioncheckNewPost(x){varpid=$('#NewPostbody').attr('class');if(pid==='post-t'){setTimeout(checkNewPost,);}else{$.ajax({type:"POST",url:"/html_postReply.php",data:"pid="+pid.replace('post-t','')+"&type=1",success:function(html){if(html){$('.tekin').app

javascript - 类型错误 : Cannot read property 'push' of undefined -Express

我已经为使用express路由和创建服务器的nodejs应用程序编写了两个Javascript文件。由于我是初学者,我对此了解不多。当我运行该应用程序时,它向我显示以下错误:-/usr/lib/node_modules/express/lib/router/index.js:472this.stack.push(layer);^TypeError:Cannotreadproperty'push'ofundefinedatFunction.use(/usr/lib/node_modules/express/lib/router/index.js:472:15)atObject.(/hom

javascript - 在 IE11 中下载文件出现错误 "' Uint8Array' is undefined”

我正在创建一个正在下载文件的应用程序。为此,我从js中的java类获得响应并下载此响应。为此,我的java代码是-@ApiOperation(value="",notes="")@Path("/getProjectJSONTODRAW/{implementation}")@GET@TimedpublicResponsegetProjectJSONTODRAW(@PathParam("implementation")Stringimplementation){Filefile=newFile(path+File.separator+fileName);InputStreaminputSt

javascript - Null 中的 Json 值热捕获 Javascript 异常

我从action-struts2获取数据jsonthrowajax以供我查看。一些数据集的数据。例子{"home":"1234","room":null}.我可以读取data.home,我得到1234值,但是当我尝试读取data.room时,浏览器控制台出现未捕获错误,怎么办?我确实是为了管理这个UncaughtError... 最佳答案 只需添加一个测试/*------vardata={"home":"1234","room":null},h=(data.home)?data.home:'',r=(data.room)?data.

javascript - CKEditor + IE7+8 'null or not an object' 错误

我的问题是我正在使用jQuery的CKEditor3.4插件,当在编辑器上执行$(selector).val(html)调用时,它在IE7+8中给我一个错误:错误:'this.$.innerHTML'为空或不是对象...在调试器中运行时,指向巨大的CKEditor.js中的这一行代码:getHtml:function(){vari=this.$.innerHTML;returnc?i.replace(/]*>/g,''):i;}...在源代码中翻译为:getHtml:function(){varretval=this.$.innerHTML;//StriptagsinIE.(#3341

javascript - 未捕获的类型错误 : Cannot read property 'lat' of undefined when serializing leaflet data with $. 参数()

我想先说明一下:我是JavaScript的新手。我正在尝试使用Leaflet和AJAX调用发布用户位置和map边界。在我的事件处理程序stateUpdater.onLocationFound中,日志语句打印出正确的用户坐标和map边界,但是我在尝试时得到UncaughtTypeError:Cannotreadproperty'lat'ofundefined使用$.param()序列化这些值。我正在使用Leafletv0.7.2和jQuery1.11.0。varmap;$(document).ready(function(){map=newL.map('map').setView([41

javascript - 捕捉 webhook node.js

我正在trycatch由node.js中的AftershipAPI发出的PUT/webhook请求。每次需要发出推送通知时都会发出PUT请求,我正在使用Parse发送通知,但我需要来自webhook的一些数据。webhook的header看起来像Content-Type:application/json并且包含以下数据:ts-UTCunixtimestampthattheeventoccurredevent-thenameoftheevent(fortrackingupdate,thevaluewillbe'tracking_update')msg-detailsaboutthemes

javascript - 将数据保存在数据库问题中,在控制台上收到 NULL

我是NodeJS的新手,我在尝试将某些数据保存/保存在数据库中时遇到问题。让我们从头开始,这样您会更容易理解。我有一个运动列表,可以选择选中或不选中,这就是我需要坚持的,选中的。前端:controller.js$scope.toggleSportSelection=function(sport){varparams={};params.user=$scope.customer.customer;sport.checked=!sport.checked;SportsFactory.setSportChecked(params);};service.jssetSportChecked:fu

javascript - 当你在 JavaScript 中分配 undefined 时会发生什么?

考虑以下代码:varx=undefined;这是一行自相矛盾的代码。x是否定义?JavaScript的实现是从内存中删除变量x,还是给它赋值undefined? 最佳答案 变量未声明和未定义是有区别的:varx;//xisequalto*undefined*alert(y);//error,yisundeclared这并不自相矛盾,但是多余的:varx=undefined;将undefined简单地视为变量未初始化时的值–或者对象属性未初始化时的值或声明。 关于javascript-当你

javascript - findRecord 给出错误 "Cannot read property ' _internalModel' of undefined"

在我们的ember应用程序中,我们使用以下版本的ember-data和ember-data-factory-guy。包.json"ember-cli":"^1.13.8","ember-data":"1.13.9","ember-data-factory-guy":"1.13.10",注意:我们使用的是事件模型适配器,尚未迁移到json-api适配器。importActiveModelAdapterfrom'active-model-adapter';exportdefaultActiveModelAdapter.extend({路由:item.jsexportdefaultEmber